package com.example.spring.boot.business.user;

import com.example.spring.boot.api.user.createuser.CreateUserRequest;
import com.example.spring.boot.api.user.createuser.CreateUserResponse;

public class UserModel {
    long userId;
    String userName;
    String password;
    long createTime ;

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }


    public static UserModel createBy(CreateUserRequest createUserRequest){
        UserModel userModel = new UserModel();
        userModel.setPassword(createUserRequest.getPassword());
        userModel.setUserName(createUserRequest.getUserName());
        return userModel;
    }

    public  CreateUserResponse inject(CreateUserResponse createUserResponse){
        createUserResponse.setUserName(this.getUserName());
        return createUserResponse;
    }
}
